package com.bsj.power.common.def.protocol.rtp;

import com.bsj.power.common.def.protocol.gb28181.RtpData;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class RTPInfo {
    //head  0 x 30 0 x 31 0 x 63 0 x 64

    /**
     * 1字节
     */
    private int markOne;

    /**
     * 2字节包序
     */
    private int sn;

    /**
     * 6字节sim卡
     */
    private String sim;

    /**
     * 通道号，1字节
     */
    private int channelNo;

    /**
     * 编码格式
     */
    private int payLoad;

    /**
     * 4状态位数据类型，0是I帧，1是P帧，2是B帧，3是音频帧，4是透传数据
     */
    private int dataType;

    /**
     * 4状态位分包处理标记,0是原子包，1是第一包,2是最后一包,3是中间包
     */
    private int pageMark;

    /**
     * 8字节时间戳
     */
    private long time;

    /**
     * 2字节关键帧间隔
     */
    private int lastI;

    /**
     * 2字节非关键帧间隔
     */
    private int lastNotI;

    /**
     * 数据长度
     */
    private int dataLen;

    /**
     * 数据体h264
     */
    private byte[] data;

    /**
     * 视频帧
     */
    private int nRate;

    public RTPInfo(RtpData dataAnalysis) {
        this.sim = dataAnalysis.getDevice();
        this.channelNo = dataAnalysis.getChannel();
        this.data = dataAnalysis.getData();
        this.dataLen = (int) dataAnalysis.getFlowByte();
        this.dataType = dataAnalysis.getDataType();
        this.time = dataAnalysis.getTime();
        this.nRate = dataAnalysis.getRateType();
        this.payLoad = (int) dataAnalysis.getPayLoad();
    }
}
